#!/usr/bin/env python
# encoding: utf-8
"""
Shovelhead
File: LoopAdsr.py
Author: Olivier Belanger

Generates an ADSR envelope for the sound loop.
"""

from pyo import *
import random

class LoopAdsr:

    def __init__(self, list, dur, min, max, freq):

        self.table = LinTable(list)
        self.randtime = Randh(min=min, max=max, freq=freq)

        self.trig = Change(self.randtime)

        self.env = TrigEnv(self.trig, self.table, dur)


    def sig(self):

        return self.env
    



